//
//  SecToViewController.m
//  JiJinFinance
//
//  Created by 李东晓 on 15/12/1.
//  Copyright © 2015年 LiDongXiao. All rights reserved.
//
#import "SecToViewController.h"
#import "SureTZViewController.h"

#import "LoginViewController.h"
@interface SecToViewController ()<UIScrollViewDelegate>
{
    UIScrollView * ScrollView;
}
//信息
@property (strong, nonatomic) IBOutlet UILabel *LabelNH;
@property (strong, nonatomic) IBOutlet UILabel *LabelXM;
@property (weak, nonatomic) IBOutlet UIView *ViewXian;
@property (strong, nonatomic) IBOutlet UILabel *LabelNHnum;
@property (strong, nonatomic) IBOutlet UILabel *LabelXMnum;
@property (strong, nonatomic) IBOutlet UIImageView *ImageTJ;
@property (strong, nonatomic) IBOutlet UILabel *LabelBFH;

//按钮
@property (strong, nonatomic) IBOutlet UIButton *ButtonXM;
@property (strong, nonatomic) IBOutlet UIButton *ButtonDY;
@property (strong, nonatomic) IBOutlet UIButton *ButtonQY;
@property (strong, nonatomic) IBOutlet UIButton *ButtonTZ;

//详情信息
@property (weak, nonatomic) IBOutlet UIView *ViewQY;
@property (weak, nonatomic) IBOutlet UIView *ViewTZ;
@property (weak, nonatomic) IBOutlet UIView *ViewDY;
@property (weak, nonatomic) IBOutlet UIView *ViewXM;

//TabBarView
@property (weak, nonatomic) IBOutlet UIView *ViewTabBar;
@property (strong, nonatomic) IBOutlet UITextField *RMBTextField;
@property (strong, nonatomic) IBOutlet UILabel *LabelYUAN;
@property (strong, nonatomic) IBOutlet UIButton *ButtonLJTZ;

#warning 假数据
@property (strong, nonatomic) IBOutlet UIImageView *XXImage;

@end

@implementation SecToViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    [self.view setBackgroundColor:[UIColor whiteColor]];
    
    self.title = @"爱车贷";
    
    [_ButtonXM setBackgroundColor:RGBAColor(246, 246, 246, 1)];

    [self SlideUIViewLoadView];
    [self Frame];
    [self BackButton];
    
}
#pragma 确定刚进入界面时的默认ViewXM的位置
-(void)viewWillAppear:(BOOL)animated
{
    [self.tabBarController.tabBar setHidden:YES];

}
#pragma 可选择按钮＋View的信息
-(void)SlideUIViewLoadView
{
    //可选择按钮容器
    UIView * Slideview = [[UIView alloc]initWithFrame:CGRectMake(0, 318*D_height, kUIScreenWidth, 44*D_height)];
    [Slideview setBackgroundColor:RGBAColor(215, 215, 215, 1)];
    [self.view addSubview:Slideview];
    //点击按钮
    [_ButtonXM setFrame:CGRectMake(10*D_width, 320*D_height, 89*D_width, 42*D_height)];
    [self.view addSubview:_ButtonXM];
    [_ButtonDY setFrame:CGRectMake(96*D_width, 320*D_height, 89*D_width, 42*D_height)];
    [self.view addSubview:_ButtonDY];
    [_ButtonQY setFrame:CGRectMake(184*D_width, 320*D_height, 89*D_width, 42*D_height)];
    [self.view addSubview:_ButtonQY];
    [_ButtonTZ setFrame:CGRectMake(272*D_width, 320*D_height, 89*D_width, 42*D_height)];
    [self.view addSubview:_ButtonTZ];
    
    //装载View的容器
    ScrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 362*D_height, kUIScreenWidth, 240*D_height)];
    [ScrollView setContentSize:CGSizeMake(kUIScreenWidth * 4, 0)];
    
    [ScrollView setDelegate:self];
    
    //禁止滑动的方法
    ScrollView.scrollEnabled = NO;
    
    [ScrollView setBackgroundColor:[UIColor greenColor]];
    
    [self.view addSubview:ScrollView];
    
    //详情信息的View
    
    
    [_ViewXM setFrame:CGRectMake(0, 0, kUIScreenWidth, 240*D_height)];
    [ScrollView addSubview:_ViewXM];
    [_ViewDY setFrame:CGRectMake(kUIScreenWidth, 0, kUIScreenWidth, 240*D_height)];
    [ScrollView addSubview:_ViewDY];
    [_ViewQY setFrame:CGRectMake(kUIScreenWidth*2, 0, kUIScreenWidth, 240*D_height)];
    [ScrollView addSubview:_ViewQY];
    [_ViewTZ setFrame:CGRectMake(kUIScreenWidth*3, 0,kUIScreenWidth, 240*D_height)];
    [ScrollView addSubview:_ViewTZ];
    
#warning 假数据
    [_XXImage setFrame:CGRectMake(0, 0, kUIScreenWidth, 240*D_height)];
    [_ViewXM addSubview:_XXImage];
}
#pragma 按钮的点击方法
- (IBAction)XMClick {
    
    NSLog(@"项目详情");
    [ScrollView setContentOffset:CGPointMake(0, 0) animated:YES];
    [_ButtonXM setBackgroundColor:RGBAColor(246, 246, 246, 1)];
    
    [_ButtonDY setBackgroundColor:RGBAColor(215, 215, 215, 1)];
    [_ButtonTZ setBackgroundColor:RGBAColor(215, 215, 215, 1)];
    [_ButtonQY setBackgroundColor:RGBAColor(215, 215, 215, 1)];
}
- (IBAction)DYClick {
    
    NSLog(@"抵押物信息");
    [ScrollView setContentOffset:CGPointMake(kUIScreenWidth, 0) animated:YES];
    [_ButtonDY setBackgroundColor:RGBAColor(246, 246, 246, 1)];
    
    [_ButtonXM setBackgroundColor:RGBAColor(215, 215, 215, 1)];
    [_ButtonTZ setBackgroundColor:RGBAColor(215, 215, 215, 1)];
    [_ButtonQY setBackgroundColor:RGBAColor(215, 215, 215, 1)];
    
}
- (IBAction)QYClick {
    NSLog(@"企业信息");
    [ScrollView setContentOffset:CGPointMake(kUIScreenWidth*2, 0) animated:YES];
    
    [_ButtonQY setBackgroundColor:RGBAColor(246, 246, 246, 1)];
    
    [_ButtonXM setBackgroundColor:RGBAColor(215, 215, 215, 1)];
    [_ButtonDY setBackgroundColor:RGBAColor(215, 215, 215, 1)];
    [_ButtonTZ setBackgroundColor:RGBAColor(215, 215, 215, 1)];
}
- (IBAction)TZClick {
    NSLog(@"投资记录");
    [ScrollView setContentOffset:CGPointMake(kUIScreenWidth*3, 0) animated:YES];
    
    [_ButtonTZ setBackgroundColor:RGBAColor(246, 246, 246, 1)];
    
    [_ButtonXM setBackgroundColor:RGBAColor(215, 215, 215, 1)];
    [_ButtonDY setBackgroundColor:RGBAColor(215, 215, 215, 1)];
    [_ButtonQY setBackgroundColor:RGBAColor(215, 215, 215, 1)];
}


#pragma 用比例进行适配
-(void)Frame
{
    //统计
    [_ImageTJ setFrame:CGRectMake(139*D_width, 96*D_height, 101*D_width, 101*D_height)];
    //年化收益
    [_LabelNH setFrame:CGRectMake(96*D_width, 222*D_height, 48*D_width, 12*D_height)];
    [_LabelNH setFont:[UIFont systemFontOfSize:12 * D_width]];
    //年化收益数字
    [_LabelNHnum setFrame:CGRectMake(75*D_width, 249*D_height, 67*D_width, 27*D_height)];
    [_LabelNHnum setFont:[UIFont boldSystemFontOfSize:27*D_width]];
    //数字百分比
    [_LabelBFH setFrame:CGRectMake(148*D_width, 263*D_height, 14*D_width, 13*D_height)];
    [_LabelBFH setFont:[UIFont systemFontOfSize:13*D_width]];
    
    //画线
    [_ViewXian setFrame:CGRectMake(188*D_width, 221*D_height, 2, 56*D_height)];
    //项目期限
    [_LabelXM setFrame:CGRectMake(225*D_width, 222*D_height, 48*D_width, 12*D_height)];
    [_LabelXM setFont:[UIFont systemFontOfSize:12*D_width]];
    //项目期限时间
    [_LabelXMnum setFrame:CGRectMake(215*D_width, 250*D_height, 76*D_width, 26*D_height)];
    [_LabelXMnum setFont:[UIFont systemFontOfSize:26*D_width]];
    
    //TabBar
    [_ViewTabBar setFrame:CGRectMake(0, 600*D_height, kUIScreenWidth, 70*D_height)];
    [_RMBTextField setFrame:CGRectMake(18*D_width, 22*D_height, 94*D_width, 26*D_height)];
    [_LabelYUAN setFrame:CGRectMake(98*D_width, 22*D_height, 23*D_width, 26*D_height)];
    [_ButtonLJTZ setFrame:CGRectMake(135*D_width, 22*D_height, 201*D_width, 26*D_height)];
    
}
- (IBAction)LJTZClick {
    
    LoginViewController * login = [[LoginViewController alloc]init];
    
    [self.navigationController pushViewController:login animated:YES];

}

#pragma 返回按钮
-(void)BackButton
{
    UIButton * button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setFrame:CGRectMake(0, 0,13,20)];
    
    [button setBackgroundColor:[UIColor clearColor]];
    
    [button setImage:[UIImage imageNamed:@"navigation_back"] forState:UIControlStateNormal];
    
    [button addTarget:self action:@selector(BackClick) forControlEvents:UIControlEventTouchUpInside];
    
    UIBarButtonItem * barbutton = [[UIBarButtonItem alloc]initWithCustomView:button];
    
    self.navigationItem.leftBarButtonItem = barbutton;
    
}
#pragma 返回按钮的点击方法
-(void)BackClick
{
    [self.navigationController popViewControllerAnimated:YES];
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
